import HttpService from '../../app/services/httpService.js';

class RaceService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	RaceListUrl: this.URL + '/race/lists?company_id=',
            RaceCreateUrl: this.URL + '/race/create?company_id=',
            RaceDetailUrl: this.URL + '/race/detail?race_id=',
            RaceUpdateUrl: this.URL + '/race/update?race_id=',
            DistrictUrl: this.URL + '/public/district?upid=',
            UnbindallUrl: this.URL + '/material/unbindall?raceid='
        }

    }

    /* 赛事列表 */
    getRaceList(headers, search) {
        return this.getRequest(this.OBJ.RaceListUrl, headers, search);
    }

    /* 创建赛事 */
    postRaceCreate(params, headers, search) {
        return this.postMultipart(this.OBJ.RaceCreateUrl, params, headers, search);
    }

    /* 获取赛事详情 */
    getRaceDetail(headers, search) {
        return this.getRequest(this.OBJ.RaceDetailUrl, headers, search);
    }

    /* 更新赛事 */
    postRaceUpdate(params, headers, search) {
        return this.postMultipart(this.OBJ.RaceUpdateUrl, params, headers, search);
    }

    /* 获取省市区列表数据 */
    getDistrict(search) {
        return this.getRequest(this.OBJ.DistrictUrl, '', search);
    }

    /* 解绑赛事所有设备 */
    getUnbindall(headers, search) {
        return this.getRequest(this.OBJ.UnbindallUrl, headers, search);
    }


}

export default RaceService;